package com.java110.mall.acct.cmd.accountBond;

import com.alibaba.fastjson.JSONObject;
import com.java110.core.annotation.Java110Cmd;
import com.java110.core.context.ICmdDataFlowContext;
import com.java110.core.event.cmd.Cmd;
import com.java110.core.event.cmd.CmdEvent;
import com.java110.dto.account.AccountBondDto;
import com.java110.mall.acct.bmo.accountBond.IGetAccountBondBMO;
import com.java110.utils.exception.CmdException;
import com.java110.utils.util.BeanConvertUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;

@Java110Cmd(serviceCode = "accountBond.queryAccountBond")
public class QueryAccountBondCmd extends Cmd {
    @Autowired
    private IGetAccountBondBMO getAccountBondBMOImpl;
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
        super.validatePageInfo(reqJson);
    }

    @Override
    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {

        AccountBondDto accountBondDto = BeanConvertUtil.covertBean(reqJson, AccountBondDto.class);
        ResponseEntity<String> response = getAccountBondBMOImpl.get(accountBondDto);

        context.setResponseEntity(response);
    }
}
